import {http} from '../../network/index'

const searchlist = {
    state: {
        list: [],
    },
    mutations: {
        listc(state) {
            state.list = []
        },
        searchlist(state, obj) {
            state.list = []
            var list = obj.item.list
            var value = obj.value
            list.forEach(item => {
                if (item.title.includes(value)) {
                    state.list.push(item)
                }
            })


        },
    },
    actions: {
        Searchlist(context, value) {
            http.courseBasis({
                params: {
                    page: 0,
                    limit: 178,
                }
            }).then((res) => {

                var obj = {
                    item: res.data.data,
                    value: value
                }
                context.commit('searchlist', obj)
            });
        },
    },
    modules: {}
}

export default searchlist